﻿using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace DesignByFarooq.PowershellByExample.Testing
{
    [TestClass]
    public class TupleT1T2UnitTest
    {
        [TestMethod]
        public void InstancesEqual()
        {
            DesignByFarooq.PowershellByExample.Tuple<int, int> tuple = new Tuple<int, int>(
                1,
                2
                );

            DesignByFarooq.PowershellByExample.Tuple<int, int> copy = tuple;

            Assert.AreEqual(
                tuple,
                copy
                );
        }

        [TestMethod]
        public void InstancesNotEqual()
        {
            DesignByFarooq.PowershellByExample.Tuple<int, int> tuple = new Tuple<int, int>(
                1,
                2
                );

            Assert.AreNotEqual(
                null as Tuple<int, int>,
                tuple
                );
           
        }

        [TestMethod]
        public void InstancesNotEqual2()
        {
            DesignByFarooq.PowershellByExample.Tuple<int, int> tuple1 = new Tuple<int, int>(
                1,
                2
                );

            DesignByFarooq.PowershellByExample.Tuple<int, string> tuple2 = new Tuple<int, string>(
                1,
                "hello"
                );


            Assert.AreNotEqual(
                tuple1,
                tuple2
                );

        }

        [TestMethod]
        public void InstancesNotEqual3()
        {
            DesignByFarooq.PowershellByExample.Tuple<int, int> tuple1 = new Tuple<int, int>(
                1,
                2
                );

            DesignByFarooq.PowershellByExample.Tuple<int, int> tuple2 = new Tuple<int, int>(
                1,
                3
                );


            Assert.AreNotEqual(
                tuple1,
                tuple2
                );

        }

        [TestMethod]
        public void InstancesNotEqual4()
        {
            DesignByFarooq.PowershellByExample.Tuple<int, int> tuple1 = new Tuple<int, int>(
                2,
                2
                );

            DesignByFarooq.PowershellByExample.Tuple<int, int> tuple2 = new Tuple<int, int>(
                1,
                2
                );


            Assert.AreNotEqual(
                tuple1,
                tuple2
                );

        }

        [TestMethod]
        public void InstancesNotEqual5()
        {
            DesignByFarooq.PowershellByExample.Tuple<int, int> tuple1 = new Tuple<int, int>(
                2,
                3
                );

            DesignByFarooq.PowershellByExample.Tuple<int, int> tuple2 = new Tuple<int, int>(
                4,
                5
                );


            Assert.AreNotEqual(
                tuple1,
                tuple2
                );

        }

        [TestMethod]
        public void CallToString()
        {
            DesignByFarooq.PowershellByExample.Tuple<int, int> tuple1 = new Tuple<int, int>(
                2,
                3
                );

            string expectedString = "(2,3)";
            string actualString = tuple1.ToString();

            Assert.AreEqual(
                expectedString,
                actualString
                );
        }
    }
}
